<?php echo $this->element('slide'); ?>
<section id="content">
	<section id="left-bar">
		<div class="box-left">
			<?php echo $this->element('categories'); ?>
		</div>
		
		
		<div class="box-left">
			<?php echo $this->element('genres'); ?>
		</div>
		
		
		<div class="box-left">
			<h2>Bảng xếp hạng</h2>
			<div class="menu-left">
				<ul>
					<li>
						<a href="#" class="top2"><span>1</span>Giáo dục</a>
					</li>
					
					<li>
						<a href="#" class="top2"><span>2</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>3</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>4</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>5</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>6</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>7</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>8</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>9</span>Giải trí</a>
					</li>
					
					<li>
						<a href="#" class="top10"><span>10</span>Giải trí</a>
					</li>
					
				</ul>
			</div>
		</div>
	</section>
	
	
	<section id="right-content">
		<?php if(!$games || empty($games)) : ?>
		<p style="margin: 20px 0px; padding: 0px 0px 0px 20px" id="tag" class="tag">Không có game thuộc danh mục này</p>
		<?php else: ?>
			<p style="margin: 20px 0px; padding: 0px 0px 0px 20px" id="tag" class="tag"></p>
			<?php $stt = 0; foreach ($games as $game): ?>
				<?php  $stt++; ?>
				<?php if($stt == 1) : ?>
					<section class="box-game">
				<?php endif; ?>
					<section class="box">
						<?php echo $this->Html->image($game['Game']['thumbnail'], array('class' => 'img-box')); ?>
						
						<h3 class="game-title">
							<?php echo $this->Html->link($game['Game']['name'], '/game/'.$game['Game']['id'].'-'.$game['Game']['alias']); ?>
						</h3>
						<!---section class="rating">
							<a href="#"><img src="img/style-appstore/rat.png" alt="" /></a>
							<a href="#"><img src="img/style-appstore/rat.png" alt="" /></a>
							<a href="#"><img src="img/style-appstore/rat.png" alt="" /></a>
							<a href="#"><img src="img/style-appstore/rat.png" alt="" /></a>
							<a href="#"><img src="img/style-appstore/rat.png" alt="" /></a>
						</section-->
						<p class="genre">
							<?php 
								if(isset($game['Genre'])) {
									foreach($game['Genre'] as $genre){
										echo $this->Html->link($genre['name'], '/the-loai-game/'.$genre['id'].'-'.$genre['alias']);
									}
								}
								
								if(isset($game['Category'])) {
									foreach($game['Category'] as $category){
										echo ', ' .$this->Html->link($category['name'], '/ung-dung/'.$category['id'].'-'.$category['alias']);
									}
								}
					
								 
							?>
						</p>
						<section class="game-download">
							<?php
								if(!empty($game['System'][0])) {
									echo $this->Html->link($this->Html->image('style-appstore/android-download.png'), $game['System'][0]['GamesSystem']['download'], array('escape' => false));
								}
								
								if(!empty($game['System'][1])) {
									echo $this->Html->link($this->Html->image('style-appstore/ios-download.png'), $game['System'][1]['GamesSystem']['download'], array('escape' => false));
								}
								
								if(!empty($game['System'][2])) {
									echo $this->Html->link($this->Html->image('style-appstore/windowsphone-download.png'), $game['System'][2]['GamesSystem']['download'], array('escape' => false));
								}
							?>
							
						</section>
					</section>
				<?php if($stt == 3): ?>
				</section>
				<?php $stt = 0; endif; ?>
			<?php endforeach; ?>	
		<?php endif; ?>
	</section>
	
	
</section>